package com.mtons.mblog.web.controller.site;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.domain.Sort;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;

import com.mtons.mblog.modules.data.NavTypeVO;
import com.mtons.mblog.modules.service.NavService;
import com.mtons.mblog.web.controller.BaseController;

@Controller
@RequestMapping("/nav")
public class NavController extends BaseController {
	
	@Autowired
	private NavService navService;
	
	@RequestMapping("")
    public String nav(ModelMap model) {
		Pageable pageable = wrapPageable(Sort.by(Sort.Direction.DESC, "weight"));
		Page<NavTypeVO> page = navService.navTypeList(null, pageable, true);
		model.addAttribute("results", page);
        return view("/nav/nav");
    }
}
